# -*- coding: utf-8 -*-
from django import forms
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from django.forms.widgets import ChoiceWidget, Select
from xadmin.widgets import AdminSelectWidget, AdminTextInputWidget
import json
from .models import Purchase, Sale, GoodInPurchase, GoodInSale
from page.widgets import Qrcode, ScanSelect


class PurchaseForm(forms.ModelForm):
    class Meta:
        model = Purchase
        exclude = []
        widgets = {
            'code': Qrcode,
        }


class SaleForm(forms.ModelForm):
    class Meta:
        model = Sale
        exclude = []
        widgets = {
            'code': Qrcode,
        }


class GoodInPurchaseForm(forms.ModelForm):
    class Meta:
        model = GoodInPurchase
        exclude = []
        widgets = {
            'fk_good': ScanSelect,
        }


class GoodInSaleForm(forms.ModelForm):
    class Meta:
        model = GoodInSale
        exclude = []
        widgets = {
            'fk_good': ScanSelect,
        }